﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Castle.MonoRail.Framework;
using Rodunu.Movies.Interfaces.Movie;
using Rodunu.Movies.Logic.Movie;

namespace Rodunu.Movies.Web.ViewComponents
{
    public class UserSideMenuComponent : ViewComponent
    {
        public override void Render()
        {
            long userId = Convert.ToInt64(Context.ComponentParameters["UserId"]);

            IUserMovies userMoviesLogic = new UserMoviesLogic();
            IFriendMovieRequest friendMovieRequestLogic = new FriendMovieRequestLogic();
            PropertyBag["BorrowedMovies"] = userMoviesLogic.GetBorrowedMovies(userId);
            PropertyBag["RandomUnwatched"] = userMoviesLogic.RecommendUnwatched(userId);
            PropertyBag["OnLoan"] = friendMovieRequestLogic.GetUnreturnedMoviesForUser(userId);

            base.Render();
        }
    }
}
